import http from '../utils/request'
import { getToken } from '../utils/auth'
// import { uploadImage } from '../utils/uploadFile'
// 获取字典值
export const dictData = params => {
  return http.request({
    url: `/house/comm/DictData`,
    method: 'get',
    params
  })
}
//图片上传
export function unloadImg(item) {
	return new Promise((resolve, reject) => {  
		uni.uploadFile({
			url: `${process.env.VUE_APP_BASE_URL}`+'/house/comm/uploadMaterial2', //后台地址
			filePath: item.path,
		  name: 'file',
      header:{
        Token:getToken()
      },
			success: (uploadFileRes) => {
        console.log('upload',uploadFileRes)
				resolve(JSON.parse(uploadFileRes.data)); 
			}
		})
	})
}

// 生成小程序分享二维码
export const createQRCode = data => {
  return http.request({
    url: `/house/comm/createQRCode`,
    method: 'post',
    data
  })
}

// 邀请管家扫码之后操作
export const invitehousekeeper = params => {
  return http.request({
    url: `/house/manage/invitehousekeeper`,
    method: 'get',
    params
  })
}

export const getSharTextHouseList = params => {
  return http.request({
    url: `/house/manage/getSharTextHouseList`,
    method: 'get',
    params
  })
}

